/**
 * 活动相关接口
 */
import request from '../lib/js/request'
import { BASE_URL } from './config'

/**
 * 创建活动
 */
export function createActivity(data) {
  return request({
    url: `${BASE_URL}/avtivity`,
    method: 'post',
    data: data
  })
}

/**
 * 获取活动信息接口
 */
export function getActivity(page, size) {
  page = page === undefined ? 1 : page
  size = size === undefined ? 5 : size
  return request({
    url: `${BASE_URL}/avtivity/list?page=${page}&size=${size}`,
    method: 'get'
  })
}

/**
 * 收到的活动请求
 */
export function getReceiveActivityApply() {
  return request({
    url: `${BASE_URL}/avtivity/apply/receive`
  })
}

/**
 * 发送的活动请求
 */
export function getSendActivityAppy() {
  return request({
    url: `${BASE_URL}/avtivity/apply/send`
  })
}

/**
 * 拒绝用户的活动申请
 */
export function refuseActivityAppy(applyId) {
  return request({
    url: `${BASE_URL}/avtivity/apply/refuse?applyId=${applyId}`
  })
}

/**
 * 接受的活动申请
 */
export function acceptActivityAppy(applyId) {
  return request({
    url: `${BASE_URL}/avtivity/apply/accept?applyId=${applyId}`
  })
}
